<?php
	class New_model extends CI_Model {
	    
    var $id;	
	var $title;	    
    var $detail;

    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }   

    function info($id)
    {
        $this->db->select('*');
        $this->db->from('news');
        $this->db->where('id',$id);

        $query = $this->db->get();
        return $query->row();
    }

    function info_slug($slug)
    {
        $this->db->select('*');
        $this->db->from('news');
        $this->db->where('slug',$slug);

        $query = $this->db->get();
        return $query->row();
    }

    function infos()
    {
        $query = $this->db->get('news');

        return $query->result();
    }    

    function insert($data)
    {
        return $this->db->insert('news', $data);
    }

    function update($data, $id)
    {
        $this->db->where('id',$id);
        return $this->db->update('news', $data);
    }
}